package com.jml.filter;

import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

//过滤器2
public class TwoGatewayFilter implements GatewayFilter {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        //前置过滤器代码块
        System.out.println("pre-filter-【222】 ");
        return chain.filter(exchange).then(Mono.fromRunnable(() -> {
            //后置过滤器代码块
            System.out.println("post-filter-【222】 ");
        }));
    }
}
